<script>
  // 1
  {
    if (true) {
      var varX = true
    }
    console.assert(varX === true, '1. 不成立')
  }
  // 2
  {
    if (true) {
      let letX = true
    }
    try {
      const fn = function() {return letX }
      fn()
      console.assert(false, '2. 应设法进入catch')
    } catch (e) {
      console.assert(e instanceof ReferenceError, '2. 不成立')
    }
  }
  3
  {
    let obj = { x: 1 }
    for (let key in obj) {
    }
    try {
      const fn = function() {return key}
      fn()
      console.assert(false, '3. 应设法进入catch')
    } catch (e) {
      console.assert(e instanceof ReferenceError, '3. 不成立')
    }
  }
  // 4
  {
    {
      var letX = true
    }
    try {
      const fn = function(){ return letX }
      fn()
      console.assert(false, '4. 应设法进入catch')
    } catch (e) {
      console.assert(e instanceof ReferenceError, '4. 不成立')
    }
  }
</script>
